

class MyCode
def recursionDirCreateSubSpace(path1,space,&block)
    ignore = ['.','..','.xcodeproj','.xcworkspace','.xcassets','.lproj']

    Dir.foreach(path1){ 
        |file|
        extname = File::extname(file)
        if ignore.include?(file)
            next
        end
        if ignore.include?(extname) && extname.length > 0
            next
        end
        tmpPath = "#{path1}/#{file}"
        
        if File::ftype(tmpPath) == "directory" 

            space.subspec file do |tmpS|
                tmp_source_files = "#{tmpPath}/*.{h,m}"

                tmpS.name = "#{file}"
                p file
                tmpS.source_files = tmp_source_files
                #Proc 可以这么，无限调用block
                #if tmpPro
                #    tmpPro.call(tmpPath,tmpS)
                #end

                block.call(tmpPath,tmpS)
                
                recursionDirCreateSubSpace(tmpPath,tmpS,&block)
            end
        end
    }
end


end

Pod::Spec.new do |s|
    s.name = 'TestPodSpace'
    s.version = '1.0'
    s.summary = 'MSGeneral'
    s.homepage = 'https://gitee.com/408477779/test-pod-space.git'
    s.license = { :type => 'MIT', :file => 'LICENSE' }
    s.author = { 'TestPodSpace' => 'TestPodSpace' }
    s.source = { :git => 'https://gitee.com/408477779/test-pod-space.git',:submodules => true}
    s.ios.deployment_target = '10.0'
    s.source_files = 'testPodSpace/testPodSpace/*.{h,m}'
    s.requires_arc = true
    s.static_framework = true
    #小细节，这个OTHER_LIBTOOLFLAGS ，podSpec只会认为这是个字符串，很难受
    #s.pod_target_xcconfig = {'OTHER_LDFLAGS'=>['$(inherited)','ObjC','-l"facexdet"','-l"facexlive"','-l"ssl"','${PODS_ROOT}/MSAIRecord/MSGeneral/MSGeneral/Vendor/SDK/MSStandardizedOCRSDK/MSStandardizedOCRSDK.a'],
    #                         'OTHER_LIBTOOLFLAGS'=>'$(inherited) -ObjC',
    #}


    MyCode.new.recursionDirCreateSubSpace("testPodSpace/testPodSpace",s) do |tmpPath,subSpec| 
            p  tmpPath
            p subSpec
    end
end

